﻿// Program.cs
using WeekEight;

internal class Program
{
    private static void Main(string[] args)
    {
        IUserService userService = new UserService();

        // 注册测试
        User user1 = new User("user001", "123456");
        bool registerResult = userService.Register(user1);
        System.Console.WriteLine($"注册结果: {registerResult}"); 

        // 重复注册测试
        User user1Copy = new User("user001", "123456");
        registerResult = userService.Register(user1Copy);
        System.Console.WriteLine($"重复注册结果: {registerResult}"); 

        // 登录测试
        User loggedInUser = userService.Login("user001", "123456");
        System.Console.WriteLine($"登录用户: {loggedInUser?.Username ?? "登录失败"}"); 

        // 遍历测试（调用 GetAllUsers 触发 foreach）
        userService.GetAllUsers();

        // 删除测试（调用 for 循环删除）
        userService.DeleteUser("user001");
        System.Console.WriteLine("删除后重新遍历:");
        userService.GetAllUsers(); 
    }
}